﻿<%@ CodePage = 65001 %>

<!--#include file="includes/database.asp" -->
<!--#include file="includes/global_varaiable.asp" -->
<!--#include file="film_info.asp" -->
<!--#include file="includes/aspmkrfn.asp" -->

<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.addHeader "cache-control", "no-cache"
Response.addHeader "cache-control", "no-store"
Response.CacheControl = "no-cache"

Response.Buffer = True

Const ewSessionMessage = "Message"

' Load key from QueryString
x_FilmID = Request.QueryString("FilmID")
If x_FilmID = "" Or IsNull(x_FilmID) Then
	Response.Redirect("film_list.asp")
End If

x_Action = Request.QueryString("act")

sSQL = "SELECT * FROM CHITIETPHIM a INNER JOIN CHANNEL b ON a.ChannelID = b.ChannelID INNER JOIN STUDIO c ON a.StudioID = c.StudioID INNER JOIN THELOAI d ON a.GenreID = d.GenreID WHERE a.FilmID=" & x_FilmID

response.write(sSQL)

' Set up Record Set
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, adoCon, 1, 2

	' Get fields from form
	x_Channel = rs("ChannelName")
	x_Title = rs("Title")
	x_Genre = rs("Genre")
	x_Director = rs("Director")
	x_Actor = rs("Actor")
	StartTime = rs("StartTime")
	x_FinishTime = rs("FinishTime")
	x_Length = rs("Length")
	x_Rank = rs("Rank")
	x_Studio = rs("StudioName")
	x_Country = rs("Country")
	x_Link = rs("Link")
	x_Summary = rs("Summary")
	x_Content = rs("Content")
	x_Image = rs("Image")
	x_AuthorID = Session("StaffID")
	x_Stars = rs("Stars")
	
	x_Status=0
	if(rs("Status")="1") then
	x_Status=1
	end if
	
	x_Sticky=0
	if(rs("IsSticky")="1") then
	x_Sticky=1
	end if
		
	
	If EditData() Then ' Add New Record
			Session(ewSessionMessage) = "Sửa thành công"
			adoCon.Close ' Close adoConection
			Set adoCon = Nothing
			Response.Clear
			Response.Redirect "film_list.asp"

	End If

%>
<!--#include file="header.asp"-->

<script type="text/javascript" src="ew.js"></script>
<script type="text/javascript">
<!--
EW_dateSep = "/"; // set date separator	
//-->
</script>
<script type="text/javascript">
<!--
function EW_checkMyForm(EW_this) {
if (EW_this.x_FilmID && !EW_hasValue(EW_this.x_FilmID, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_FilmID, "TEXT", "Vui lòng nhập dữ liệu - Film ID"))
		return false;
}
if (EW_this.x_FilmID && !EW_checkinteger(EW_this.x_FilmID.value)) {
	if (!EW_onError(EW_this, EW_this.x_FilmID, "TEXT", "Film ID phải là số"))
		return false; 
}
if (EW_this.x_Status && !EW_hasValue(EW_this.x_Status, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Status, "TEXT", "Vui lòng nhập dữ liệu - Status"))
		return false;
}
if (EW_this.x_Sticky && !EW_hasValue(EW_this.x_Sticky, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Sticky, "TEXT", "Vui lòng nhập dữ liệu - Sticky"))
		return false;
}
if (EW_this.x_Channel && !EW_hasValue(EW_this.x_Channel, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Channel, "TEXT", "Vui lòng nhập dữ liệu - Channel"))
		return false;
}
if (EW_this.x_Genre && !EW_hasValue(EW_this.x_Genre, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Genre, "TEXT", "Vui lòng nhập dữ liệu - Genre"))
		return false;
}
if (EW_this.x_Studio && !EW_hasValue(EW_this.x_Studio, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Studio, "TEXT", "Vui lòng nhập dữ liệu - Studio"))
		return false;
}
if (EW_this.x_Title && !EW_hasValue(EW_this.x_Title, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Title, "TEXT", "Vui lòng nhập dữ liệu - Title"))
		return false;
}
if (EW_this.x_Director && !EW_hasValue(EW_this.x_Director, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Director, "TEXT", "Vui lòng nhập dữ liệu - Director"))
		return false;
}

if (EW_this.x_Length && !EW_hasValue(EW_this.x_Length, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Length, "TEXT", "Vui lòng nhập dữ liệu - Length"))
		return false;
}
if (EW_this.x_Length && !EW_checkinteger(EW_this.x_Length.value)) {
	if (!EW_onError(EW_this, EW_this.x_Length, "TEXT", "Length phải là số"))
		return false; 
}
if (EW_this.x_Country && !EW_hasValue(EW_this.x_Country, "TEXT" )) {
	if (!EW_onError(EW_this, EW_this.x_Country, "TEXT", "Vui lòng nhập dữ liệu - Country"))
		return false;
}
return true;
}
//-->
</script>

<%

	strSQL = "SELECT * FROM CHITIETPHIM"

	' Set up Record Set
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.CursorLocation = 3
	rs.Open strSql, adoCon, 1, 2
	rs.MoveLast
	
	Dim LastID
	LastID = rs("FilmID")
	LastID = CInt(LastID) + 1
	
	Session("LastID") = LastID
	
	rs.Close
	set rs = Nothing
	
%>
<link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-win2k-1.css" title="win2k-1" />
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="calendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="calendar/calendar-setup.js"></script>
<p><span class="aspmaker">Add to TABLE: CHITIETPHIM<br><br><a href="film_list.asp">Back to List</a></span></p>
<form action="film_edit.asp?FilmID=<%=x_FilmID%>&act=save" name="film_edit" id="film_edit" method="post" onSubmit="return EW_checkMyForm(this);">
<p>

<input type="hidden" name="a_add" value="A">
<%
If Session(ewSessionMessage) <> "" Then
%>
<p><span class="ewmsg"><%= Session(ewSessionMessage) %></span></p>
<%
	Session(ewSessionMessage) = "" ' Clear message
End If
%>
<table class="ewTable">
	<tr id="r_FilmID">
		<td class="ewTableHeader"><span>Film ID<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_FilmID">
<input type="text" name="x_FilmID" id="x_FilmID" size="50" disabled value="<%= LastID %>">
</span></td>
	</tr>
	
	<tr id="r_Channel">
		<td class="ewTableHeader"><span>Channel<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_ChannelName">

<%
x_ChannelIDList = "<select id='x_Channel' name='x_Channel'>"
x_ChannelIDList = x_ChannelIDList & "<option value=''>Please Select</option>"
sSqlWrk = "SELECT [ChannelID], [ChannelName] FROM [CHANNEL]"
Set rswrk = Server.CreateObject("ADODB.Recordset")
rswrk.Open sSqlWrk, adoCon, 1, 2
If Not rswrk.Eof Then
	datawrk = rswrk.GetRows
	rowswrk = UBound(datawrk, 2)
	For rowcntwrk = 0 To rowswrk
		x_ChannelIDList = x_ChannelIDList & "<option value='" & datawrk(0, rowcntwrk) & "'"
		If CStr(datawrk(0, rowcntwrk)&"") = CStr(x_ChannelID&"") Then
			x_ChannelIDList = x_ChannelIDList & " selected"
		End If
		x_ChannelIDList = x_ChannelIDList & ">" & datawrk(1, rowcntwrk) & "</option>"
	Next
End If
rswrk.Close
Set rswrk = Nothing
x_ChannelIDList = x_ChannelIDList & "</select>"
Response.Write x_ChannelIDList
%>
		
</span></td>
	</tr>
	
	<tr id="r_Title">
		<td class="ewTableHeader"><span>Title<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Title">
<input type="text" name="x_Title" id="x_Title" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Title&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Genre">
		<td class="ewTableHeader"><span>Genre<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Genre">
<%
x_GenreIDList = "<select id='x_Genre' name='x_Genre'>"
x_GenreIDList = x_GenreIDList & "<option value=''>Please Select</option>"
sSqlWrk = "SELECT [GenreID], [Genre] FROM [THELOAI]"
Set rswrk = Server.CreateObject("ADODB.Recordset")
rswrk.Open sSqlWrk, adoCon, 1, 2
If Not rswrk.Eof Then
	datawrk = rswrk.GetRows
	rowswrk = UBound(datawrk, 2)
	For rowcntwrk = 0 To rowswrk
		x_GenreIDList = x_GenreIDList & "<option value='" & datawrk(0, rowcntwrk) & "'"
		If CStr(datawrk(0, rowcntwrk)&"") = CStr(x_GenreID&"") Then
			x_GenreIDList = x_GenreIDList & " selected"
		End If
		x_GenreIDList = x_GenreIDList & ">" & datawrk(1, rowcntwrk) & "</option>"
	Next
End If
rswrk.Close
Set rswrk = Nothing
x_GenreIDList = x_GenreIDList & "</select>"
Response.Write x_GenreIDList
%>
</span></td>
	</tr>
	
	<tr id="r_Director">
		<td class="ewTableHeader"><span>Director<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Director">
<input type="text" name="x_Director" id="x_Director" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Director&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Actor">
		<td class="ewTableHeader"><span>Actor<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Actor">
<input type="text" name="x_Actor" id="x_Actor" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Actor&"") %>">
</span></td>
	</tr>
	
	<tr id="r_StartTime">
		<td class="ewTableHeader"><span>Start Time<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_StartTime">
<input type="text" name="x_StartTime" id="x_StartTime" size="50" maxlength="50" value="<% If IsDate(x_StartTime) Then Response.Write EW_FormatDateTime(x_StartTime,7) Else Response.Write x_StartTime End If %>">
&nbsp;<img src="images/ew_calendar.gif" id="cx_StartTime" alt="Pick a Date" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup(
{
inputField : "x_StartTime", // ID of the input field
ifFormat : "%m/%d/%Y", // the date format
button : "cx_StartTime" // ID of the button
}
);
</script>
</span></td>
	</tr>
	
	<tr id="r_FinishTime">
		<td class="ewTableHeader"><span>Finish Time<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_FinishTime">
<input type="text" name="x_FinishTime" id="x_FinishTime" size="50" maxlength="50" value="<% If IsDate(x_FinishTime) Then Response.Write EW_FormatDateTime(x_FinishTime,7) Else Response.Write x_FinishTime End If %>">
&nbsp;<img src="images/ew_calendar.gif" id="cx_FinishTime" alt="Pick a Date" style="cursor:pointer;cursor:hand;">
<script type="text/javascript">
Calendar.setup(
{
inputField : "x_FinishTime", // ID of the input field
ifFormat : "%m/%d/%Y", // the date format
button : "cx_FinishTime" // ID of the button
}
);
</script>
</span></td>
	</tr>	
	
	<tr id="r_Length">
		<td class="ewTableHeader"><span>Length<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Length">
<input type="text" name="x_Length" id="x_Length" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Length&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Rank">
		<td class="ewTableHeader"><span>Rank<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Rank">
<input type="text" name="x_Rank" id="x_Rank" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Rank&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Studio">
		<td class="ewTableHeader"><span>Studio<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Studio">

<%
x_StudioIDList = "<select id='x_Studio' name='x_Studio'>"
x_StudioIDList = x_StudioIDList & "<option value=''>Please Select</option>"
sSqlWrk = "SELECT [StudioID], [StudioName] FROM [STUDIO]"
Set rswrk = Server.CreateObject("ADODB.Recordset")
rswrk.Open sSqlWrk, adoCon, 1, 2
If Not rswrk.Eof Then
	datawrk = rswrk.GetRows
	rowswrk = UBound(datawrk, 2)
	For rowcntwrk = 0 To rowswrk
		x_StudioIDList = x_StudioIDList & "<option value='" & datawrk(0, rowcntwrk) & "'"
		If CStr(datawrk(0, rowcntwrk)&"") = CStr(x_StudioID&"") Then
			x_StudioIDList = x_StudioIDList & " selected"
		End If
		x_StudioIDList = x_StudioIDList & ">" & datawrk(1, rowcntwrk) & "</option>"
	Next
End If
rswrk.Close
Set rswrk = Nothing
x_StudioIDList = x_StudioIDList & "</select>"
Response.Write x_StudioIDList
%>
		
</span></td>
	</tr>
	
	<tr id="r_Country">
		<td class="ewTableHeader"><span>Country<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Country">
<input type="text" name="x_Country" id="x_Country" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Country&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Link">
		<td class="ewTableHeader"><span>Link<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Link">
<input type="text" name="x_Link" id="x_Link" size="50" maxlength="50" value="<%= Server.HTMLEncode(x_Link&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Summary">
		<td class="ewTableHeader"><span>Summary<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Summary">
<textarea name="x_Summary" id="x_Summary" cols="85 " rows="5" value="<%= Server.HTMLEncode(x_Summary&"") %>"></textarea>
</span></td>
	</tr>
	
	<tr id="r_Content">
		<td class="ewTableHeader"><span>Content<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Content">
<textarea name="x_Content" id="x_Content" cols="85 " rows="15" value="<%= Server.HTMLEncode(x_Content&"") %>"></textarea>
</span></td>
	</tr>
	
	<tr id="r_Image">
		<td class="ewTableHeader"><span>Image<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Image">
<input type="text" name="x_Image" id="x_Image" size="50" value="<%= Server.HTMLEncode(x_Image&"") %>">
</span></td>
	</tr>
	
	<tr id="r_Stars">
		<td class="ewTableHeader"><span>Stars<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Stars">
<input type="radio" name="x_Stars" id="x_Stars" size="50" value="1">&nbsp;1&nbsp;
<input type="radio" name="x_Stars" id="x_Stars" size="50" value="2">&nbsp;2&nbsp;
<input type="radio" name="x_Stars" id="x_Stars" size="50" value="3">&nbsp;3&nbsp;
<input type="radio" name="x_Stars" id="x_Stars" size="50" value="4">&nbsp;4&nbsp;
<input type="radio" name="x_Stars" id="x_Stars" size="50" value="5">&nbsp;5&nbsp;
</span></td>
	</tr>
	
	<tr id="r_Status">
		<td class="ewTableHeader"><span>Status<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Status">
<input type="checkbox" name="x_Status" id="x_Status" value="1">
</span></td>
	</tr>
	
	<tr id="r_Sticky">
		<td class="ewTableHeader"><span>Sticky<span class='ewmsg'>&nbsp;*</span></span></td>
		<td class="ewTableAltRow"><span id="cb_x_Sticky">
<input type="checkbox" name="x_Sticky" id="x_Sticky" value="1">
</span></td>
	</tr>
	
</table>
<p>
<input type="submit" name="btnAction" id="btnAction" value="EDIT">
</form>
<!--#include file="footer.asp"-->
<%
adoCon.Close ' Close adoConection
Set adoCon = Nothing
%>
<%

'-------------------------------------------------------------------------------
' Function LoadData
' - Load Data based on Key Value
' - Variables setup: field variables

Function LoadData()
	Dim rs, sSql, sFilter
	sFilter = ewSqlKeyWhere
	sFilter = Replace(sFilter, "@FilmID", AdjustSql(x_FilmID)) ' Replace key value
	sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "")
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open sSql, adoCon
	If rs.Eof Then
		LoadData = False
	Else
		LoadData = True
		rs.MoveFirst

		' Get the field contents
		x_FilmID = rs("FilmID")
		x_Status = rs("Status")
		x_Sticky = rs("IsSticky")
		x_Channel = rs("ChannelName")
		x_Title = rs("Title")
		x_Genre = rs("Genre")
		x_Director = rs("Director")
		x_Actor = rs("Actor")
		x_Length = rs("Length")
		x_Studio = rs("StudioName")
		x_Country = rs("Country")
		x_DateCreated = rs("DateCreated")
	End If
	rs.Close
	Set rs = Nothing
End Function
%>
<%

'-------------------------------------------------------------------------------
' Function EditData
' - Add Data
' - Variables used: field variables

Function EditData()
	Dim rs, sSql, sFilter
	Dim bCheckKey, sSqlChk, sWhereChk
	sFilter = ewSqlKeyWhere
	
	bCheckKey = True
	
	' Add New Record
	sFilter = "FilmID=" & x_FilmID
	sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "")
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.CursorLocation = 3
		
	rs.Open sSql, adoCon, 1, 2
	
	response.write(sSql)
	
	' Clone new rs object
	Dim rsnew
	Set rsnew = rs.Clone(1)
	'rs.Update

	' Field FilmID
	sTmp = x_FilmID
	If Not IsNumeric(sTmp) Then
		sTmp = 0
	Else
		sTmp = CLng(sTmp)
	End If
	rs("FilmID") = sTmp
	
	'response.write(sTmp & "<br>")
	
	' Field ChannelID
	sTmp = x_Channel
	If Not IsNumeric(sTmp) Then
		sTmp = Null
	Else
		sTmp = CLng(sTmp)
	End If
	rs("ChannelID") = sTmp
	
	' Field Title
	sTmp = Trim(x_Title)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Title") = sTmp
	
	' Field GenreID
	sTmp = x_Genre
	If Not IsNumeric(sTmp) Then
		sTmp = Null
	Else
		sTmp = CLng(sTmp)
	End If
	rs("GenreID") = sTmp
	
	' Field Director
	sTmp = Trim(x_Director)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Director") = sTmp
	
	' Field Actor
	sTmp = Trim(x_Actor)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Actor") = sTmp
	
	' Field StartTime
	sTmp = x_StartTime
	If Trim(sTmp) = "" Then sTmp = Null
	rs("StartTime") = sTmp
	
	' Field FinishTime
	sTmp = x_FinishTime
	If Trim(sTmp) = "" Then sTmp = Null
	rs("FinishTime") = sTmp
	
	' Field Length
	sTmp = x_Length
	If Not IsNumeric(sTmp) Then
		sTmp = Null
	Else
		sTmp = CLng(sTmp)
	End If
	rs("Length") = sTmp
	
	' Field Rank
	sTmp = x_Rank
	If Not IsNumeric(sTmp) Then
		sTmp = Null
	Else
		sTmp = CLng(sTmp)
	End If
	rs("Rank") = sTmp
	
	' Field Studio
	sTmp = x_Studio
	If Not IsNumeric(sTmp) Then
		sTmp = Null
	Else
		sTmp = CLng(sTmp)
	End If
	rs("StudioID") = sTmp
	
	' Field Country
	sTmp = Trim(x_Country)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Country") = sTmp
	
	' Field Link
	sTmp = Trim(x_Link)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Link") = sTmp
	
	' Field Summary
	sTmp = Trim(x_Summary)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Summary") = sTmp
	
	' Field Content
	sTmp = Trim(x_Content)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Content") = sTmp
	
	' Field Image
	sTmp = Trim(x_Image)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("Image") = sTmp
	
	' Field AuthorID
	sTmp = Trim(x_AuthorID)
	If Trim(sTmp) = "" Then sTmp = Null
	rs("AuthorID") = sTmp
	
	' Field Stars
	sTmp = x_Stars
	If Not IsNumeric(sTmp) Then
		sTmp = Null
	Else
		sTmp = CLng(sTmp)
	End If
	rs("Stars") = sTmp
	
	' Field DateCreated
	sTmp = now()
	rs("DateCreated") = sTmp
	
	' Field Status
	sTmp = x_Status
	rs("Status") = sTmp
	
	' Field Sticky
	sTmp = x_Sticky
	rs("IsSticky") = sTmp
	
	'response.write(sTmp & "<br>")

	' Call recordset inserting event
	If Recordset_Inserting(rs) Then
		rs.Update
		EditData = True
	Else
		rs.CancelUpdate
		EditData = False
	End If
	rs.Close
	Set rs = Nothing

	' Call recordset inserted event
	If EditData Then
		Call Recordset_Inserted(rsnew)
	End If
	rsnew.Close
	Set rsnew = Nothing
End Function

'-------------------------------------------------------------------------------
' Recordset inserting event

Function Recordset_Inserting(rsnew)
	On Error Resume Next

	' Please enter your customized codes here
	Recordset_Inserting = True
End Function

'-------------------------------------------------------------------------------
' Recordset inserted event

Sub Recordset_Inserted(rsnew)
	On Error Resume Next

	' Get key value
	Dim sKey
	sKey = ""
	If sKey <> "" Then sKey = sKey & ","
	sKey = sKey & rsnew.Fields("FilmID")
End Sub
%>
